local PATH_FIG = "~/Downloads/figures"

/* Figure 4: Gallup Trust in Government */

use fg4_gallup_trust_in_govt, clear
gen trust = great_deal + fair_amount

gen trust_FI = trust if govt_level == "Fed_Intl"
gen trust_FD = trust if govt_level == "Fed_Dom"
gen trust_S  = trust if govt_level == "State"
gen trust_L  = trust if govt_level == "Local"

collapse trust_* great_deal_fair_amount_D great_deal_fair_amount_R, by(year)
drop if year <= 1990

scatter trust_FD trust_S trust_L year, c(l l l) xtitle("") legend(off) mcolor(gs9 gs6 gs0) lcolor(gs9 gs6 gs0) plotregion(style(none)) graphregion(fcolor(white) lcolor(white)) ///
 xlabel(2000 2005 2010 2015 2020, labsize(large)) ylabel(40 50 60 70 80, labsize(large)) yscale(range(32 85)) ytitle("Trust in Government", size(vlarge)) ///
 text(34 2020 "Federal", color(gs9) size(large)) text(60 2018 "State", color(gs6) size(large)) text(75 2020 "Local", color(gs0) size(large))
graph export "`PATH_FIG'/fg4_Gallup_Trust_in_Govt.pdf", replace


scatter *_D *_R year, c(l l l) xtitle("") legend(off) mcolor(blue red) lcolor(blue red) plotregion(style(none)) graphregion(fcolor(white) lcolor(white)) ///
 xlabel(2000 2005 2010 2015 2020, labsize(large)) ylabel(40 50 60 70 80, labsize(large)) yscale(range(32 85)) ytitle("Trust in Local Government", size(vlarge)) ///
 text(62 2012 "Democrats", color(blue) size(large)) text(65 2021 "Republicans", color(red) size(large))
graph export "`PATH_FIG'/fg4_Gallup_Trust_in_Govt_DR.pdf", replace


/* Original sources:
https://news.gallup.com/poll/5392/Trust-Government.aspx (but doesn't have partisan split?)
% 2018 writeup: https://news.gallup.com/poll/243563/americans-trusting-local-state-government.aspx
% 2023 writeup: https://news.gallup.com/poll/512651/americans-trust-local-government-congress-least.aspx
*/
